import { request } from "../../request/index.js";
Page({
    data:{
        //轮播图数组
        swiperList:[],
        //导航
        cateList:[],
        //楼层
        floorList:[],
    },
    onLoad:function(options){
         //1 发送异步请求获取轮播图数据  优化的手段可以通过es6的 promise来解决这个问题 
       this.getSwiperList();
       this.getCateList();
       this.getFloorList();
        },
        //获取轮播图
        getSwiperList(){
            request({ url: "/home/swiperdata" })
            .then(result => {
              this.setData({
                swiperList: result
              })
            })
        },

        getCateList(){
            request({ url: "/home/catitems" })
            .then(result => {
              this.setData({
                cateList: result
              })
            })
        },

        getFloorList(){
            request({ url: "/home/floordata" })
            .then(result => {
              this.setData({
                floorList: result
              })
            })
          },
})